<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2017/9/25
 * Time: 14:46
 */

namespace app\common\model;


class City extends Base
{
    /*
     *获取城市分类 ,获取城市的父类id
     */
    public function getNormalCitysByParentId($parentId=0) {
        $data = [
            'status' => 1,
            'parent_id' => $parentId,
        ];

        $order = [
            'id' => 'desc',
        ];

        return $this->where($data)
            ->order($order)
            ->select();
    }

    /**
     * 获取二级城市数据 (admin/deal/index)
     */
    public function getNormalCitys() {
        $data = [
            'status' => 1,
            'parent_id' => ['gt', 0], // 不等于0
        ];

        $order = ['id'=>'desc'];

        return $this->where($data)
            ->order($order)
            ->select();

    }
}